package com.jun.admin.core.controller;

import com.jun.admin.core.service.ExcelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author yuejun.li
 * @date 2024/10/8 10:04:50
 */
@Api(tags = "报表controller")
@RestController
@RequestMapping("easyexcel")
@AllArgsConstructor
@Slf4j
public class EasyExcelController {

    private ExcelService excelService;

    @ApiOperation("导入")
    @PostMapping("import")
    public void excelImport(MultipartFile file) throws IOException {
        excelService.excelImport(file);
    }

    @ApiOperation("导出")
    @PostMapping("export")
    public void excelExport(HttpServletResponse response) throws IOException {
        excelService.excelExport(response);
    }

    @ApiOperation("填充")
    @GetMapping("fill")
    public void excelFill(HttpServletResponse response) throws IOException {
        excelService.excelFill(response);
    }
}
